<template>
	<view>
		<u-subsection :list="list" :current="current" @change="change" active-color="#ff9900"></u-subsection>
		<view class="order-list">
			<view class="order-item" v-for="item in orderList">
				<view class="top">
					<text>{{item.path}}</text>
					<view class="status center" v-if="item.status === 0">未付款</view>
					<view class="status center" v-else style="background-color: #909399;">已付款</view>
				</view>
				<view class="id">订单编号：{{item.orderNum}}</view>
				<view class="date">订单生成日期：{{item.createTime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					{
						name: '未付款'
					},
					{
						name: '已付款'
					}
				],
				current: 0,
				orderList: []
			};
		},
		onLoad() {
			this.getOrder()
		},
		methods: {
			getOrder(){
				this.$request({
					url: '/prod-api/api/bus/order/list'
				}).then(res => {
					this.orderList = res.rows.filter(item => item.status === this.current)
				})
			},
			change(index){
				this.current = index
				this.getOrder()
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #f7f7f7;
	view{
		.order-list{
			display: flex;
			flex-direction: column;
			padding: 20rpx;
			.order-item{
				padding: 20rpx;
				background-color: #fff;
				display: flex;
				flex-direction: column;
				.top{
					padding: 20rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					text{
						color: #2979ff;
						font-size: 32rpx;
						font-weight: bold;
					}
					.status{
						width: 120rpx;
						height: 60rpx;
						color: white;
						font-size: 26rpx;
						background-color: #fa3534;
						border-radius: 10rpx;
					}
				}
				.id{
					padding: 20rpx 0;
					font-size: 26rpx;
				}
				.date{
					font-size: 26rpx;
				}
			}
		}
	}
}
</style>
